#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void printk(int d);
int main()
{
    int a1[1000],a2[1000];
    int a1head,a1tail,a2head,a2tail;
    a1head = a1tail = a2head = a2tail = 0;
    int n,d;
    scanf("%d",&n);
    for(int i = 0;i < n;i ++)
    {
        scanf("%d",&d);
        if(d%2)
        a1[a1tail ++] = d;
        else
        a2[a2tail ++] = d;

    }
    while(a1head < a1tail || a2head < a2tail)
    {
        if(a1head< a1tail)printk(a1[a1head++]);
        if(a1head< a1tail)printk(a1[a1head++]);
        if(a2head< a2tail)printk(a2[a2head++]);
    }
}
void printk(int d)
{
    static int flag = 0;
    if(flag)putchar(' ');
    printf("%d",d);
    flag ++;
}
